var e = require;
var t = module;
var o = exports;
var ii, nn = this && this.__extends || (ii = function (t, e) {
    return (ii = Object.setPrototypeOf || {
        __proto__: []
    }
        instanceof Array &&
        function (t, e) {
            t.__proto__ = e
        } ||
        function (t, e) {
            for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
        })(t, e)
},
    function (t, e) {
        function o() {
            this.constructor = t
        }
        ii(t, e),
            t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
    }
),
    rr = this && this.__awaiter ||
        function (t, e, o, i) {
            return new (o || (o = Promise))(function (n, a) {
                function r(t) {
                    try {
                        l(i.next(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function s(t) {
                    try {
                        l(i.
                            throw(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function l(t) {
                    var e;
                    t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
                        t(e)
                    })).then(r, s)
                }
                l((i = i.apply(t, e || [])).next())
            })
        };
var oo = (this && this.__decorate) ||
    function (e, t, a, n) {
        var i,
            o = arguments.length,
            s = o < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, a)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);
        else
            for (var r = e.length - 1; r >= 0; r--)
                (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
        return o > 3 && s && Object.defineProperty(t, a, s), s;
    }; Object.defineProperty(o, "__esModule", { value: !0 });
var a = (function () {
    function e() { }
    return (
        (e.loadResArray = function (e, t) {
            var o = new Array(),
                a = 0,
                n = cc.ENGINE_VERSION;
            if (Number(n[2]) < 4)
                for (
                    var i = function (n) {
                        cc.loader.load(e[n], function (i, r) {
                            if (((o[n] = r), null != i || null == o[n]))
                                return console.log("ASCSDK", "资源加载错误:" + JSON.stringify(i)), void t(!0, null);
                            ++a >= e.length && t(!1, o);
                        });
                    },
                    r = 0;
                    r < e.length;
                    r++
                )
                    i(r);
            else {
                var s = function (n) {
                    cc.assetManager.loadRemote(e[n], function (i, r) {
                        if (((o[n] = r), null != i || null == o[n]))
                            return console.log("ASCSDK", "资源加载错误:" + JSON.stringify(i)), void t(!0, null);
                        ++a >= e.length && t(!1, o);
                    });
                };
                for (r = 0; r < e.length; r++) s(r);
            }
        }),
        (e.loadResCustom = function (e, t, o) {
            var a = cc.ENGINE_VERSION;
            Number(a[2]) < 4
                ? cc.loader.load(e, function (a, n) {
                    if (!n && a) return console.log(e, "  资源加载错误:" + JSON.stringify(a)), void (o && o());
                    t(n);
                })
                : cc.assetManager.loadRemote(e, { ext: ".png" }, function (a, n) {
                    if (!n && a) return console.log(e, "  资源加载错误:" + JSON.stringify(a)), void (o && o());
                    t(n);
                });
        }),
        (e.loadResJsonInfo = function (e, t, o) {
            cc.assetManager.loadRemote(e, function (a, n) {
                if ((console.log("===JSON=====", n), !n && a))
                    return console.log(e, "  资源加载错误:" + JSON.stringify(a)), void o();
                t(n);
            });
        }),
        e
    );
})();
o.default = a;
